package com.example.back.controller;

import com.example.back.dto.req.ConfigReq;
import com.example.back.service.BusConfigService;
import com.example.common.entity.CMS;
import com.example.common.entity.Hospital;
import com.example.common.support.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "业务设置")
@RequestMapping("/api/BusConfig")
public class BusConfigController {

    @Resource
    private BusConfigService busConfigService;

    @ApiOperation(value = "读取配置")
    @PostMapping(value = "/GetConfig")
    public Result<Map<String, Object>> GetConfig() {
        return Result.success(busConfigService.GetConfig());
    }

    @ApiOperation(value = "保存就诊说明与知情告知书")
    @PostMapping(value = "/SaveCms")
    public Result<String> SaveCms(@RequestBody CMS cms) {
        return Result.success(busConfigService.SaveCms(cms));
    }
    
    @ApiOperation(value = "保存药房配置")
    @PostMapping(value = "/SaveSelf")
    public Result<String> SaveSelf(@RequestBody Hospital req) {
        return Result.success(busConfigService.SaveSelf(req));
    }

    @ApiOperation(value = "保存服务配置")
    @PostMapping(value = "/SaveConfig")
    public Result<String> SaveConfig(@RequestBody ConfigReq req) {
        return Result.success(busConfigService.SaveConfig(req));
    }
}
